// cLogger.cpp: implementation of the cLogger class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "qpmig.h"
#include "cLogger.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

cLogger::cLogger()
{
	m_bFileOpen=m_logFile.Open("QPMigration_log.txt",CFile::modeWrite|CFile::modeCreate);

}

cLogger::cLogger(LPCSTR pStrFileName)
{
	m_bFileOpen=m_logFile.Open(pStrFileName,CFile::modeWrite|CFile::modeCreate);

}

cLogger::~cLogger()
{
	if(m_bFileOpen)
		m_logFile.Close();
	m_bFileOpen=FALSE;
}

void cLogger::LogOneLine(LPCSTR pLogInfo)
{
	if(m_bFileOpen)
		{
			m_logFile.WriteString(pLogInfo);
			m_logFile.WriteString("\r\n");
		}
	TRACE("\r\n");
	TRACE(pLogInfo);

}

void cLogger::Flush()
{
	if(m_bFileOpen)
		m_logFile.Flush();

}

void cLogger::Close()
{
	if(m_bFileOpen)
		m_logFile.Close();
	m_bFileOpen=FALSE;

}
